package com.koron.ticket.work.workflow.controller;

import com.koron.bean.base.Response;
import com.koron.common.core.config.ThreadLocalContext;
import com.koron.ticket.work.workflow.bean.WorkFlow;
import com.koron.ticket.work.workflow.service.WorkFlowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.koron.ebs.mybatis.ADOConnection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("work/workflow")
@Api(tags = "两票管理-工作票签名")
public class WorkFlowController {

    private String getCurrDs() {
        return ThreadLocalContext.get().getCurrDs();
    }

    @Autowired
    private WorkFlowService workFlowService;

    @PostMapping("updateList")
    @ApiOperation("更新签名的deleteFlag信息为用户已要求签名")
    public Response updateList(@RequestBody List<WorkFlow> workFlowList) {
        return ADOConnection.runTask(getCurrDs(),workFlowService,"updateList", Response.class, workFlowList);
    }

    @GetMapping("batchDeleteById")
    @ApiOperation("根据id批量删除")
    public Response batchDeleteById(@RequestParam List<String> idList) {
        return ADOConnection.runTask(getCurrDs(),workFlowService,"batchDeleteById", Response.class, idList);
    }

}
